package com.itheima.Test;

import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) {

        int[] arr = {19,28,37,46,50};
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要查找的数据");
        int num = sc.nextInt();
        int index = -1;

        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == num){
                    index = i;
                break;
            }
        }
        System.out.println(index);
    }
}
